package com.bzm.controller.goods;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.apache.dubbo.config.annotation.Reference;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.bzm.common.entity.HttpCode;
import com.bzm.common.entity.JsonResult;
import com.bzm.dubbo.api.goods.GoodsInfoDubboService;
import com.bzm.pojo.goods.GoodsInfo;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;

@Slf4j
@Api(tags = "商品信息")
@Controller
@RequestMapping("/goodsInfo")
public class GoodsInfoController {

    @Reference
    private GoodsInfoDubboService goodsInfoDubboService;

    @ApiOperation(value = "查询商品列表")
    @GetMapping("/selectList")
    @ResponseBody
    public JsonResult<List<GoodsInfo>> selectList(HttpServletRequest request){
        List<GoodsInfo> list = goodsInfoDubboService.selectList();
        return new JsonResult<List<GoodsInfo>>(list, HttpCode.SUCCESS);
    }
}
